package es.ubu.interfaz;

import java.awt.Color;
import java.awt.EventQueue;

import javax.swing.ButtonGroup;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.border.EmptyBorder;

@SuppressWarnings("serial")
public class RadioButtonGroup extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					RadioButtonGroup frame = new RadioButtonGroup();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public RadioButtonGroup() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JRadioButton rdbtnNombre = new JRadioButton("Nombre");
		rdbtnNombre.setBounds(5, 5, 424, 23);
		rdbtnNombre.setBackground(new Color(240, 240, 240));
		contentPane.add(rdbtnNombre);
		
		JRadioButton rdbtnCargo = new JRadioButton("Cargo");
		rdbtnCargo.setBounds(5, 31, 424, 23);
		contentPane.add(rdbtnCargo);
		
		JRadioButton rdbtnCodPostal = new JRadioButton("Cod.Postal");
		rdbtnCodPostal.setBounds(5, 57, 424, 23);
		contentPane.add(rdbtnCodPostal);
		
		//Group the radio buttons.
	    ButtonGroup group = new ButtonGroup();
	    group.add(rdbtnNombre);
	    group.add(rdbtnCargo);
	    group.add(rdbtnCodPostal);
	}

}
